I'm running Powershell v3.0 on a Windows 7 machine
I have a script to return recursive file counts for all directories for a give path:
$myPath = Get-ChildItem -Directory
foreach ($subDirectory in $myPath) {
Write-Output Get-ChildItem -File -Recurse -LiteralPath $subDirectory.FullName | Measure-Object -Property length | Select-Object -ExpandProperty Count
}
This script works great until I have directories with square brackets ("[" or "]") in the directory name. In that case, nothing is returned. In fact, running the following script for a real folder with files in it displays nothing on the console when there are definitely files in this directory:
Get-ChildItem -File -Recurse -LiteralPath ".\test [1]"
Any ideas? Is this a known bug? I've searched this forum and others and have found nobody with the same issue, so I suspect I'm missing something.
Thanks in advance,
Ryan